{% extends "_base.html" %}
{% block title %}{{item_info['itemname']}} - 商品页{% endblock %}
{% block script %}
<script type="text/javascript">
    $(function(){
        // 按钮事件
        $(".item-button").button().click(function(){
            link = $(this).attr("rel");
            location.href = link;
        });
        {% if item_info['buyer_id'] %}
            $(".item-button").hide();
        {% else %}
            {% if not _session %}
            {% elif _session['user_info']['id'] == item_info['owner_id'] %}
                $(".item-button span").text("删除");
                $(".item-button").attr("rel", "/item/del?id={{item_info['id']}}");
            {% endif %}
        {% endif %}
    });
</script>
{% endblock %}
{% block content %}
<div id="item-div">
    <div class="item-div-left">
        <img class="item-photo-big" src="/item/photo?id={{item_info['id']}}" title="商品图片" />
    </div>
    <div class="item-div-middle">
        <div class="item-describe-row">
            <label class="item-title">商品名称：</label>
            <label class="item-value  item-name">{{item_info['itemname']}}</label>
        </div>
        <div class="item-describe-row">
            <label class="item-title">商品标签：</label>
            <label class="item-value item-tags">{{', '.join(item_info['tags'])}}</label>
        </div>
        <div class="item-describe-row">
            <label class="item-title">商品价格：</label>
            <label class="item-value"><strong class="item-price">{{item_info['price']}}</strong>元</label>
        </div>
        <div class="item-describe-row">
            <label class="item-title">添加时间：</label>
            <label class="item-value item-time">{{item_info['add_time']}}</label>
        </div>
        <div class="item-button-row">
            <button class="item-button" rel="/item/buy?id={{item_info['id']}}">购买</button>
        </div>
    </div>
</div>
<div class="item-div-detial">
    <label class="item-title">商品详情：</label><br/>
    <p class="item-detail">
    {% for line in item_info['detail'].split('\n') %}
        {{line}}<br/>
    {% endfor %}
    </p>
</div>
{% endblock %}
